<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>环境变量测试</title>
    <style>
        body { font-family: Arial, sans-serif; padding: 20px; }
        .env-info { background: #f5f5f5; padding: 15px; margin: 10px 0; border-radius: 5px; }
        .success { color: #28a745; }
        .error { color: #dc3545; }
    </style>
</head>
<body>
    <h1>环境变量配置测试</h1>
    
    <div class="env-info">
        <h3>当前环境信息：</h3>
        <p><strong>API Base URL:</strong> <span id="api-url">加载中...</span></p>
        <p><strong>App Environment:</strong> <span id="app-env">加载中...</span></p>
        <p><strong>App Title:</strong> <span id="app-title">加载中...</span></p>
    </div>
    
    <div class="env-info">
        <h3>测试结果：</h3>
        <p id="test-result">正在测试...</p>
    </div>
    
    <script>
        // 模拟获取环境变量的函数
        function getApiBaseUrl() {
            if (typeof __API_BASE_URL__ !== 'undefined') {
                return __API_BASE_URL__;
            }
            return 'http://localhost:6724'; // 默认值
        }
        
        function getAppEnv() {
            if (typeof __APP_ENV__ !== 'undefined') {
                return __APP_ENV__;
            }
            return 'development'; // 默认值
        }
        
        function getAppTitle() {
            if (typeof __APP_TITLE__ !== 'undefined') {
                return __APP_TITLE__;
            }
            return '退费审核管理系统'; // 默认值
        }
        
        // 显示环境信息
        document.getElementById('api-url').textContent = getApiBaseUrl();
        document.getElementById('app-env').textContent = getAppEnv();
        document.getElementById('app-title').textContent = getAppTitle();
        
        // 测试结果
        const apiUrl = getApiBaseUrl();
        const env = getAppEnv();
        let testResult = '';
        
        if (env === 'development' && apiUrl === 'http://localhost:6724') {
            testResult = '<span class="success">✅ 开发环境配置正确</span>';
        } else if (env === 'production' && apiUrl === 'http://10.1.200.169:6724') {
            testResult = '<span class="success">✅ 生产环境配置正确</span>';
        } else {
            testResult = '<span class="error">❌ 环境配置可能有问题</span>';
        }
        
        document.getElementById('test-result').innerHTML = testResult;
        
        console.log('Environment Test Results:');
        console.log('API Base URL:', apiUrl);
        console.log('App Environment:', env);
        console.log('App Title:', getAppTitle());
    </script>
</body>
</html>